package com.dragon.repository.domain.dto;

import com.dragon.repository.entity.ModifyLog;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.dragon.common.util.BeanUtils;

import java.util.ArrayList;
import java.util.List;
import java.util.Date;


/**
 * @author sy
 */
@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
public class ModifyLogDTO {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "自增id")
    private Integer id;

    @ApiModelProperty(value = "流程类型")
    private Integer streamType;

    @ApiModelProperty(value = "主表id")
    private Integer correlationId;

    @ApiModelProperty(value = "申请人id")
    private Integer filedAdminId;

    @ApiModelProperty(value = "申请时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private Date filedTime;

    @ApiModelProperty(value = "数据明细")
    private String dateDetails;

    @ApiModelProperty(value = "申请人名称")
    private String filedAdminName;


    public ModifyLogDTO() {}

    public ModifyLogDTO(ModifyLog entity) {
        BeanUtils.copyProperties(entity,this);
    }

    public static ModifyLogDTO convert(ModifyLog entity) {
        return new ModifyLogDTO(entity);
    }

    public static List<ModifyLogDTO> convertList(List<ModifyLog> list) {
        List<ModifyLogDTO> resultList = new ArrayList<>();
        for (ModifyLog entity : list) {
            resultList.add(new ModifyLogDTO(entity));
        }
        return resultList;
    }}
